//
//  UIView+FirstResponder.m
//  APP
//
//  Created by huanchi on 15/12/22.
//  Copyright © 2015年 上海欢炽网络科技有限公司. All rights reserved.
//

#import "UIView+Responder.h"

@implementation UIView (Responder)

-(UIView *)firstResponseView{
    if (self.isFirstResponder) {
        return self;
    }
    for (UIView *subView in self.subviews) {
        UIView *firstResponse = [subView firstResponseView];
        if (firstResponse != nil) {
            return firstResponse;
        }
    }
    return nil;
}

- (void)cancelFirstResponse{
    UIView *view = [self firstResponseView];
    if (view) {
        [view resignFirstResponder];
    }
}
@end
